import {Injectable} from "@angular/core";
import {AppConfig} from "../app.config";

/**
 * Created by duqunxing on 2017/3/6.
 */

@Injectable()
export class LogUtil {
  constructor(){}
  private log =  console;

  error(message:any){
    AppConfig.debug ?  this.log.error(message) : null;
  }
  warn(message:any){
    AppConfig.debug ? this.log.warn(message): null;
  }
  info(message:any){
    AppConfig.debug ?  this.log.info(message) :null;
  }
  debug(message:any){
    AppConfig.debug ? this.log.debug(message) :null;
  }

  /**
   * 返回日志记录器
   * @returns {Console}
   */
  logger(){
    return this.log;
  }
}
